<?php echo $this->fetch('header.html'); ?>
<DIV class="main">
<?php echo $this->fetch('header.common.html'); ?>
<div class="content_info">
  
  <div class="search">
   <form method="GET" action="<?php echo url('app=kd_order'); ?>">
    <?php if ($this->_var['config']['rewrite_enabled'] != '1'): ?><input type="hidden" value="kd_order" name="app"/><?php endif; ?>
    <input type="text" name="ydh" value="<?php if ($_GET['ydh']): ?><?php echo $_GET['ydh']; ?><?php else: ?>请输入运单号进行查询<?php endif; ?>" class="soinput"/>
    <input type="submit" class="submit_yundan" value="运单查询"/>
   </form>
  </div>
  

  <div class="daoda-box">
    <div class="box-cont">
        <?php $_from = $this->_var['yundan_list']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('key', 'list');if (count($_from)):
    foreach ($_from AS $this->_var['key'] => $this->_var['list']):
?>
        <dl class="OrderTracking">
          <?php if ($this->_var['list']['wuliu']): ?>
          <dt>
          <?php $_from = $this->_var['list']['wuliu']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'list_second');if (count($_from)):
    foreach ($_from AS $this->_var['list_second']):
?>
            <li><span class="icon"></span><p><?php echo $this->_var['list_second']['yudan_text']; ?></p><span class="time"><?php echo local_date("Y-m-d H:i:s",$this->_var['list_second']['addtime']); ?></span></li>        
          <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
          <?php else: ?>
            <li><span class="icon"></span><p>暂无物流信息</p><span class="time"><?php echo local_date("Y-m-d H:i:s",$this->_var['list']['addtime']); ?></span></li>        
          <?php endif; ?>
          </dt>
          <?php if ($this->_var['list']['expressNo']): ?>
          <dd id="query_<?php echo $this->_var['key']; ?>"></dd>
          <script type="text/javascript">
		    $.ajax({
				type: "get",
				async: false,
				url: "http://www.daoda100.com/data/jiekou/interface.php?call=yundan_mobile&express=中通快递&content=<?php echo $this->_var['list']['expressNo']; ?>",
				dataType: "jsonp",
				jsonp: "callback",//传递给请求处理程序或页面的，用以获得jsonp回调函数名的参数名(一般默认为:callback)
				jsonpCallback:"backdata",//自定义的jsonp回调函数名称，默认为jQuery自动生成的随机函数名，也可以写"?"，jQuery会自动为你处理数据
				success: function(result){
				  if(result.status=='OK'){
					  var objson = eval("("+ result['result'] +")");
					  if(typeof(objson['traces'])=='undefined'){
						  $("#query_<?php echo $this->_var['key']; ?>").hide();
					  }else{
						  $.each(objson['traces'],function(k){  
							$("#query_<?php echo $this->_var['key']; ?>").append('<li><span class="icon"></span><p>'+objson['traces'][k]['remark']+'</p><span class="time">'+objson['traces'][k]['acceptTime']+'</span></li>'); 
						  }); 
					  }
				  }else{
					  $("#query_<?php echo $this->_var['key']; ?>").hide();
				  }
				},error: function(){
				  $("#query_<?php echo $this->_var['key']; ?>").hide();
				}
			 });
		  </script>
        </dl>
        <?php endif; ?>
        <?php endforeach; else: ?>
        <div class="error"><?php if ($_GET['ydh']): ?>非常抱歉，您的查询的单号无记录!<?php else: ?>请输入运单号进行查询<?php endif; ?></div>
        <?php endif; unset($_from); ?><?php $this->pop_vars();; ?>
    </div>
  </div>  
</div>
<?php echo $this->fetch('footer.html'); ?>
</DIV> 
</body>
</html>